<html>
<head><meta charset="utf-8"><title>using iterate on visit_place · t-compiler/wg-mir-opt · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/index.html">t-compiler/wg-mir-opt</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html">using iterate on visit_place</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="167032412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167032412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167032412">(May 31 2019 at 20:38)</a>:</h4>
<p>I was discussing with <span class="user-mention" data-user-id="124288">@oli</span> earlier about using <code>Place::iterate</code> to implement visit_place and have some better API there</p>



<a name="167032482"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167032482" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167032482">(May 31 2019 at 20:40)</a>:</h4>
<p>right now, <code>visit_place</code> does <a href="https://github.com/rust-lang/rust/blob/master/src/librustc/mir/visit.rs#L686" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc/mir/visit.rs#L686">https://github.com/rust-lang/rust/blob/master/src/librustc/mir/visit.rs#L686</a></p>



<a name="167032555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167032555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167032555">(May 31 2019 at 20:40)</a>:</h4>
<p>and the <code>visit_projection</code> calls <code>visit_place</code> again passing base <a href="https://github.com/rust-lang/rust/blob/master/src/librustc/mir/visit.rs#L701" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc/mir/visit.rs#L701">https://github.com/rust-lang/rust/blob/master/src/librustc/mir/visit.rs#L701</a> so you end in this way recursing and traversing the full thing</p>



<a name="167032590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167032590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167032590">(May 31 2019 at 20:41)</a>:</h4>
<p>I wanted to propose an API that's going to be better for <code>Place 2.0</code> and a bit better IMO</p>



<a name="167032720"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167032720" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167032720">(May 31 2019 at 20:42)</a>:</h4>
<p>basically we can have <code>visit_place</code> iterating over the projections backwards and calling <code>visit_projection</code> on each and then calling <code>visit_place_base</code> on the base</p>



<a name="167032730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167032730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167032730">(May 31 2019 at 20:42)</a>:</h4>
<p>to do that you call <code>iterate</code> have the base and the proj iterator</p>



<a name="167032740"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167032740" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167032740">(May 31 2019 at 20:42)</a>:</h4>
<p>something like ...</p>



<a name="167032747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167032747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167032747">(May 31 2019 at 20:43)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="n">place</span><span class="p">.</span><span class="n">iterate</span><span class="p">(</span><span class="o">|</span><span class="n">place_base</span><span class="p">,</span><span class="w"> </span><span class="n">place_projection</span><span class="o">|</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">for</span><span class="w"> </span><span class="n">proj</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="n">place_projection</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="bp">self</span><span class="p">.</span><span class="n">visit_projection</span><span class="p">(</span><span class="n">proj</span><span class="p">,</span><span class="w"> </span><span class="n">context</span><span class="p">,</span><span class="w"> </span><span class="n">location</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>

<span class="w">    </span><span class="bp">self</span><span class="p">.</span><span class="n">visit_place_base</span><span class="p">(</span><span class="n">place_base</span><span class="p">,</span><span class="w"> </span><span class="n">context</span><span class="p">,</span><span class="w"> </span><span class="n">location</span><span class="p">);</span><span class="w"></span>
<span class="p">})</span><span class="w"></span>
</pre></div>



<a name="167032910"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167032910" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167032910">(May 31 2019 at 20:44)</a>:</h4>
<p>so implementors can just implement visit_projection if they need to change that behavior, can implement visit_place_base and rely on the fact that the default <code>visit_place</code> impl will traverse everything or can just implement the full thing if they need to change everything</p>



<a name="167033076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167033076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167033076">(May 31 2019 at 20:46)</a>:</h4>
<p>the problem I'm having is that <code>iterate</code> takes a shared reference and this visitors definitions are under a macro that uses <code>mutability</code> to define the mutable or immutable visitor</p>



<a name="167033125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167033125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167033125">(May 31 2019 at 20:47)</a>:</h4>
<p>so in particular that <code>proj</code> you see in the code is an immutable thing</p>



<a name="167033139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167033139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167033139">(May 31 2019 at 20:47)</a>:</h4>
<p>but visit_projection signature is:</p>



<a name="167033232"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167033232" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167033232">(May 31 2019 at 20:48)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="k">fn</span> <span class="nf">visit_projection</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">,</span><span class="w"></span>
<span class="w">                    </span><span class="n">place_projection</span>: <span class="kp">&amp;</span> <span class="cp">$($mutability</span><span class="p">)</span><span class="o">?</span><span class="w"> </span><span class="n">Projection</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">                    </span><span class="n">context</span>: <span class="nc">PlaceContext</span><span class="p">,</span><span class="w"></span>
<span class="w">                    </span><span class="n">location</span>: <span class="nc">Location</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
</pre></div>



<a name="167033303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167033303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167033303">(May 31 2019 at 20:49)</a>:</h4>
<p>a couple of questions:</p>



<a name="167033315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167033315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167033315">(May 31 2019 at 20:49)</a>:</h4>
<p>1. do you think that worth changing the API?</p>



<a name="167033384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167033384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167033384">(May 31 2019 at 20:50)</a>:</h4>
<p>2. in that case, I guess the best thing I can do is define <code>iterate</code> and <code>iterate_mut</code>, right?, any other better approach?</p>



<a name="167035548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035548">(May 31 2019 at 21:22)</a>:</h4>
<blockquote>
<p>1. do you think that worth changing the API?</p>
</blockquote>
<p>do we know any places that will <em>want</em> to visit the "base" and "projection" cases?</p>



<a name="167035558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035558">(May 31 2019 at 21:22)</a>:</h4>
<p>versus overloading <code>visit_place</code> as a whole</p>



<a name="167035688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035688">(May 31 2019 at 21:24)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/monomorphize/collector.rs#L663-L676" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/monomorphize/collector.rs#L663-L676">https://github.com/rust-lang/rust/blob/master/src/librustc_mir/monomorphize/collector.rs#L663-L676</a></p>



<a name="167035704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035704">(May 31 2019 at 21:25)</a>:</h4>
<p>I guess this is only about overriding base behavior and doing the default thing afterwards</p>



<a name="167035713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035713">(May 31 2019 at 21:25)</a>:</h4>
<p>I feel like that case would work equally well</p>



<a name="167035719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035719">(May 31 2019 at 21:25)</a>:</h4>
<p>if you only had a hook on <code>visit_place</code></p>



<a name="167035724"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035724" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035724">(May 31 2019 at 21:25)</a>:</h4>
<p>i.e., there is one base, so it could just be</p>



<a name="167035737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035737">(May 31 2019 at 21:26)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="k">fn</span> <span class="nf">visit_place</span><span class="p">(</span><span class="n">place</span>: <span class="kp">&amp;</span><span class="nc">mir</span>::<span class="n">Place</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="k">match</span><span class="w"> </span><span class="n">place</span><span class="p">.</span><span class="n">base</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">...</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="167035785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035785">(May 31 2019 at 21:26)</a>:</h4>
<p>(especially in MIR 2.0 where this is very efficient)</p>



<a name="167035802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035802">(May 31 2019 at 21:26)</a>:</h4>
<p>I think a more compelling case might be something like <code>visit_local</code></p>



<a name="167035810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035810">(May 31 2019 at 21:26)</a>:</h4>
<p>which I...think we also have?</p>



<a name="167035814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035814">(May 31 2019 at 21:26)</a>:</h4>
<p>i.e., we should visit the <em>base</em> recursively</p>



<a name="167035823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035823">(May 31 2019 at 21:26)</a>:</h4>
<p>well, on MIR 2.0 would be different</p>



<a name="167035824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035824">(May 31 2019 at 21:26)</a>:</h4>
<p>but that's the easy case</p>



<a name="167035840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035840">(May 31 2019 at 21:27)</a>:</h4>
<p>ah let's not forget</p>



<a name="167035843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035843">(May 31 2019 at 21:27)</a>:</h4>
<p><code>iterate</code> probably won't exist anymore</p>



<a name="167035846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035846">(May 31 2019 at 21:27)</a>:</h4>
<p><code>foo.bar[baz]</code></p>



<a name="167035854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035854">(May 31 2019 at 21:27)</a>:</h4>
<p>where <code>baz</code> would itself be a place (that is part of a projection)</p>



<a name="167035860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035860">(May 31 2019 at 21:27)</a>:</h4>
<p>iterate would just be <code>(place.base, place.projection)</code></p>



<a name="167035867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035867">(May 31 2019 at 21:27)</a>:</h4>
<p>and hence could be removed</p>



<a name="167035879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035879">(May 31 2019 at 21:27)</a>:</h4>
<p>but <code>iterate</code> is a handy method to move towards Place 2.0</p>



<a name="167035932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035932">(May 31 2019 at 21:28)</a>:</h4>
<p>I can just change the impl of it and done</p>



<a name="167035989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167035989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167035989">(May 31 2019 at 21:29)</a>:</h4>
<p>this <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/transform/inline.rs#L690-L709" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/transform/inline.rs#L690-L709">https://github.com/rust-lang/rust/blob/master/src/librustc_mir/transform/inline.rs#L690-L709</a> is also only about base</p>



<a name="167036130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036130">(May 31 2019 at 21:31)</a>:</h4>
<p>anyway, I guess my main question then is the opposite, why there's a default implementation if it's not very useful and we always override it?</p>



<a name="167036197"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036197" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036197">(May 31 2019 at 21:32)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I'm trying to see if it's possible to do a default impl that is more convenient</p>



<a name="167036215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036215">(May 31 2019 at 21:32)</a>:</h4>
<blockquote>
<p>anyway, I guess my main question then is the opposite, why there's a default implementation if it's not very useful and we always override it?</p>
</blockquote>
<p>why do you say that?</p>



<a name="167036240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036240">(May 31 2019 at 21:33)</a>:</h4>
<p>there are definitely cases where we don't override it</p>



<a name="167036246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036246">(May 31 2019 at 21:33)</a>:</h4>
<p>it seems like the current one does the same thing as what you are proposing, basically</p>



<a name="167036252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036252">(May 31 2019 at 21:33)</a>:</h4>
<p>that is, it recurses into the content</p>



<a name="167036326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036326">(May 31 2019 at 21:34)</a>:</h4>
<p>yes it does</p>



<a name="167036329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036329">(May 31 2019 at 21:34)</a>:</h4>
<p>in any case, looking at a few more examples and thinking about it</p>



<a name="167036343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036343">(May 31 2019 at 21:34)</a>:</h4>
<p>the problem is the it traverses the thing using recursion</p>



<a name="167036345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036345">(May 31 2019 at 21:34)</a>:</h4>
<p>I think you probably <em>do</em> want to recurse -- at least, I see a number of MIR visitors that only override <code>visit_local</code></p>



<a name="167036349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036349">(May 31 2019 at 21:34)</a>:</h4>
<p>and I'm changing the structure to not be recursive</p>



<a name="167036372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036372">(May 31 2019 at 21:35)</a>:</h4>
<p>and a local can be inside a place</p>



<a name="167036385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036385">(May 31 2019 at 21:35)</a>:</h4>
<p>so we do need the default impl of <code>visit_place</code> to recurse and handle those cases</p>



<a name="167036390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036390">(May 31 2019 at 21:35)</a>:</h4>
<p>basically this relies on the implementor calling super_place to have the recursion</p>



<a name="167036394"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036394" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036394">(May 31 2019 at 21:35)</a>:</h4>
<p>and that's a thing I don't like that much</p>



<a name="167036402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036402">(May 31 2019 at 21:35)</a>:</h4>
<blockquote>
<p>basically this relies on the implementor calling super_place to have the recursion</p>
</blockquote>
<p>what do you mean by "this"</p>



<a name="167036456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036456">(May 31 2019 at 21:36)</a>:</h4>
<p>I don't really understand your critique of the current structure, which I think is pretty natural given that place is a tree right now, but I agree it's not the obvious structure you want if place is <em>not</em> a tree</p>



<a name="167036465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036465">(May 31 2019 at 21:36)</a>:</h4>
<p>I think the structure you're proposing seems right to me</p>



<a name="167036467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036467">(May 31 2019 at 21:36)</a>:</h4>
<p>but it will need an <code>iterator_mut</code> method presumably</p>



<a name="167036469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036469">(May 31 2019 at 21:36)</a>:</h4>
<p>kind of annoying</p>



<a name="167036483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036483">(May 31 2019 at 21:37)</a>:</h4>
<blockquote>
<p>I don't really understand your critique of the current structure, which I think is pretty natural given that place is a tree right now, but I agree it's not the obvious structure you want if place is <em>not</em> a tree</p>
</blockquote>
<p>yeah, that's the thing</p>



<a name="167036495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036495">(May 31 2019 at 21:37)</a>:</h4>
<p>the current structure is right for the recursive Place</p>



<a name="167036497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036497">(May 31 2019 at 21:37)</a>:</h4>
<p>for instance <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/transform/inline.rs#L707" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/transform/inline.rs#L707">https://github.com/rust-lang/rust/blob/master/src/librustc_mir/transform/inline.rs#L707</a></p>



<a name="167036501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036501">(May 31 2019 at 21:37)</a>:</h4>
<p>that's problematic when you're structure is not recursive</p>



<a name="167036556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036556">(May 31 2019 at 21:38)</a>:</h4>
<p>basically I need to avoid that call and roll all the Place traversing there</p>



<a name="167036567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036567">(May 31 2019 at 21:38)</a>:</h4>
<p>that's why the default implementation is not helping that much</p>



<a name="167036610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036610">(May 31 2019 at 21:39)</a>:</h4>
<p>ok, so maybe I see what you are saying: the implementors of today's visitor are expecting a recursive structure</p>



<a name="167036611"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036611" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036611">(May 31 2019 at 21:39)</a>:</h4>
<p>and have to be adapted to the new API?</p>



<a name="167036613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036613">(May 31 2019 at 21:39)</a>:</h4>
<p>(if so, I argee)</p>



<a name="167036616"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036616" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036616">(May 31 2019 at 21:39)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="167036623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036623">(May 31 2019 at 21:39)</a>:</h4>
<p>and also</p>



<a name="167036638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036638">(May 31 2019 at 21:39)</a>:</h4>
<blockquote>
<p>but it will need an <code>iterator_mut</code> method presumably</p>
</blockquote>
<p>this structure I'm talking about it's probable a mid step in my PR</p>



<a name="167036641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036641">(May 31 2019 at 21:40)</a>:</h4>
<p>(it might even want a different name)</p>



<a name="167036690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036690">(May 31 2019 at 21:40)</a>:</h4>
<p>just to make sure you look at each impl</p>



<a name="167036707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036707">(May 31 2019 at 21:40)</a>:</h4>
<p>it will probably not be present after the final implementation is ready with projections being an slice</p>



<a name="167036714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036714">(May 31 2019 at 21:40)</a>:</h4>
<p>once projection is a slice</p>



<a name="167036730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036730">(May 31 2019 at 21:41)</a>:</h4>
<p>so that's an interesting thing</p>



<a name="167036742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036742">(May 31 2019 at 21:41)</a>:</h4>
<p>I forget what the final API is going to be here <em>but</em></p>



<a name="167036744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036744">(May 31 2019 at 21:41)</a>:</h4>
<p>you can just do <code>place.base</code> and <code>for proj in place.projection</code></p>



<a name="167036749"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036749" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036749">(May 31 2019 at 21:41)</a>:</h4>
<p>visiting "mutably" may not be so easy</p>



<a name="167036755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036755">(May 31 2019 at 21:41)</a>:</h4>
<p>if the place is to have projections be an interned slice</p>



<a name="167036761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036761">(May 31 2019 at 21:41)</a>:</h4>
<p>since that will not be <code>&amp;mut</code></p>



<a name="167036820"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036820" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036820">(May 31 2019 at 21:42)</a>:</h4>
<p>(Is there a recent-ish write up about what Place 2.0 is going to be? I'm not sure I know enough to even form an opinion.)</p>



<a name="167036826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036826">(May 31 2019 at 21:42)</a>:</h4>
<p>yeah, we would probably want to not have <code>visit_projection</code> anymore</p>



<a name="167036834"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036834" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036834">(May 31 2019 at 21:42)</a>:</h4>
<p>there aren't very many mut visitors I don't think</p>



<a name="167036837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036837">(May 31 2019 at 21:42)</a>:</h4>
<p>the one in NLL will be a bit of a difficulty</p>



<a name="167036850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036850">(May 31 2019 at 21:42)</a>:</h4>
<p>(it rewrites types, and types can appear in projections etc)</p>



<a name="167036872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036872">(May 31 2019 at 21:43)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> I think it's here <a href="https://paper.dropbox.com/doc/Place-2.0-current-PR-status--AeI5IB7l~bBywohy7t9iTW03Ag-vmbnFv8VkCEuL57QfWWMH" target="_blank" title="https://paper.dropbox.com/doc/Place-2.0-current-PR-status--AeI5IB7l~bBywohy7t9iTW03Ag-vmbnFv8VkCEuL57QfWWMH">https://paper.dropbox.com/doc/Place-2.0-current-PR-status--AeI5IB7l~bBywohy7t9iTW03Ag-vmbnFv8VkCEuL57QfWWMH</a></p>



<a name="167036954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036954">(May 31 2019 at 21:44)</a>:</h4>
<blockquote>
<p>yeah, we would probably want to not have <code>visit_projection</code> anymore</p>
</blockquote>
<p>I mean, we can just have <code>visit_place</code> and that won't be a problem, but unsure I see what you're saying</p>



<a name="167036982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167036982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167036982">(May 31 2019 at 21:44)</a>:</h4>
<blockquote>
<p>(it rewrites types, and types can appear in projections etc)</p>
</blockquote>
<p>ahh we would need to have write access there, so ... ???</p>



<a name="167037010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037010">(May 31 2019 at 21:45)</a>:</h4>
<p>yes, the mut-visitor structure is just kind of problematic here</p>



<a name="167037017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037017">(May 31 2019 at 21:45)</a>:</h4>
<p>it seems like a lot of the mut-visitors that exist override <code>visit_local</code></p>



<a name="167037021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037021">(May 31 2019 at 21:45)</a>:</h4>
<p>(which can also appear in projections)</p>



<a name="167037098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037098">(May 31 2019 at 21:46)</a>:</h4>
<p>I don't know what's the best solution here</p>



<a name="167037119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037119">(May 31 2019 at 21:46)</a>:</h4>
<p>but it seems to me that the <code>MutVisitor</code> will have to offer a more limited API</p>



<a name="167037127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037127">(May 31 2019 at 21:46)</a>:</h4>
<p>one can update a <code>Place</code> but to modify things <em>within</em> a place you will have to use a "folder" and re-intern the results</p>



<a name="167037157"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037157" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037157">(May 31 2019 at 21:47)</a>:</h4>
<p>on the one hand, the current <code>MutVisitor</code> is very nicely efficient (modifying in place etc)..</p>



<a name="167037164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037164">(May 31 2019 at 21:47)</a>:</h4>
<p>...but there is also a good case for making it more "folder-like"</p>



<a name="167037205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037205">(May 31 2019 at 21:48)</a>:</h4>
<p>(...and actually it probably travereses a lot of IR that will never be modified, I wonder if LLVM can strip that stuff out)</p>



<a name="167037228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037228">(May 31 2019 at 21:48)</a>:</h4>
<p>by folder-like I mean having an interface like <code>fn fold_local(Local) -&gt; Local</code></p>



<a name="167037231"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037231" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037231">(May 31 2019 at 21:48)</a>:</h4>
<p>instead of <code>visit_local(&amp;mut Local)</code></p>



<a name="167037239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037239">(May 31 2019 at 21:48)</a>:</h4>
<p>I guess it'd be worth looking at what the existing mut visitors do exactly</p>



<a name="167037246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037246">(May 31 2019 at 21:48)</a>:</h4>
<p>ok :)</p>



<a name="167037264"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037264" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037264">(May 31 2019 at 21:49)</a>:</h4>
<p>my guess is we'll wind up with a more limited <code>MutVisitor</code> API</p>



<a name="167037278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037278">(May 31 2019 at 21:49)</a>:</h4>
<p>one that includes things like <code>visit_statement</code></p>



<a name="167037305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037305">(May 31 2019 at 21:49)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="167037314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037314">(May 31 2019 at 21:49)</a>:</h4>
<p>but not the really detailed things like <code>visit_local</code></p>



<a name="167037316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037316">(May 31 2019 at 21:49)</a>:</h4>
<p>or <code>visit_ty</code></p>



<a name="167037323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037323">(May 31 2019 at 21:50)</a>:</h4>
<p>those we would instead want to be more "folder-like"</p>



<a name="167037373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037373">(May 31 2019 at 21:50)</a>:</h4>
<p>so that they can apply to projections too</p>



<a name="167037405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037405">(May 31 2019 at 21:50)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="167037414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037414">(May 31 2019 at 21:50)</a>:</h4>
<p>so back a bit about what I was saying, do you think I should do the <code>iterate_mut</code> thing then?</p>



<a name="167037418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037418">(May 31 2019 at 21:50)</a>:</h4>
<p>I meant, meanwhile</p>



<a name="167037427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037427">(May 31 2019 at 21:50)</a>:</h4>
<p>and probably as a mid step</p>



<a name="167037465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037465">(May 31 2019 at 21:51)</a>:</h4>
<p>I guess it's a decent mid-way step</p>



<a name="167037474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037474">(May 31 2019 at 21:51)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="167037478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037478">(May 31 2019 at 21:52)</a>:</h4>
<p>you definitely don't want to do what I'm suggesting above all together</p>



<a name="167037530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037530">(May 31 2019 at 21:52)</a>:</h4>
<p>hehe no no :)</p>



<a name="167037552"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037552" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037552">(May 31 2019 at 21:52)</a>:</h4>
<p>but also, I'm not even adding projection as a slice yet</p>



<a name="167037577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037577">(May 31 2019 at 21:53)</a>:</h4>
<p>we defined a previous step which is migrating Place to a struct but still having projection be recursive</p>



<a name="167037605"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167037605" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167037605">(May 31 2019 at 21:53)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <a href="https://github.com/rust-lang/rust/pull/60913/files#diff-f0577ac900ffbd36d3bb3421a928cbbdR1909" target="_blank" title="https://github.com/rust-lang/rust/pull/60913/files#diff-f0577ac900ffbd36d3bb3421a928cbbdR1909">https://github.com/rust-lang/rust/pull/60913/files#diff-f0577ac900ffbd36d3bb3421a928cbbdR1909</a></p>



<a name="167415537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167415537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167415537">(Jun 05 2019 at 18:19)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> <span class="user-mention" data-user-id="116009">@nikomatsakis</span> just had a couple of minutes and went ahead with what I had on my head about <code>visit_place</code></p>



<a name="167415546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167415546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167415546">(Jun 05 2019 at 18:19)</a>:</h4>
<p>just opened as WIP this <a href="https://github.com/rust-lang/rust/pull/61554" target="_blank" title="https://github.com/rust-lang/rust/pull/61554">https://github.com/rust-lang/rust/pull/61554</a></p>



<a name="167415558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167415558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167415558">(Jun 05 2019 at 18:19)</a>:</h4>
<p>I've explained the reasoning there, let me know if it's clear and what do you think about that</p>



<a name="167415634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167415634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167415634">(Jun 05 2019 at 18:20)</a>:</h4>
<p>IMO, the code this way will be a bit more clear</p>



<a name="167415668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167415668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167415668">(Jun 05 2019 at 18:20)</a>:</h4>
<p>I can continue with the rest of the things that need to be changed to see if makes sense but wanted to check with you both first</p>



<a name="167422643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167422643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167422643">(Jun 05 2019 at 19:32)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <span class="user-mention" data-user-id="124288">@oli</span> after reviewing the rest of the <code>visit_place</code> impls there are no more changes than what's on the PR</p>



<a name="167422646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167422646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167422646">(Jun 05 2019 at 19:32)</a>:</h4>
<p>so unsure if it worth, anyway give it a look</p>



<a name="167422662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167422662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167422662">(Jun 05 2019 at 19:32)</a>:</h4>
<p>I'm going to open another PR to change some of the <code>visit_place</code> impls to use <code>iterate</code></p>



<a name="167429828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167429828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167429828">(Jun 05 2019 at 21:00)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> this is the other PR <a href="https://github.com/rust-lang/rust/pull/61559" target="_blank" title="https://github.com/rust-lang/rust/pull/61559">https://github.com/rust-lang/rust/pull/61559</a></p>



<a name="167429979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/using%20iterate%20on%20visit_place/near/167429979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/using.20iterate.20on.20visit_place.html#167429979">(Jun 05 2019 at 21:02)</a>:</h4>
<p>if you don't like the first PR, maybe we can have <code>visit_place_base</code> anyway so we can get rid of <a href="https://github.com/rust-lang/rust/pull/61559/files#diff-e682b38b565035a82f29560c3b79144bR208" target="_blank" title="https://github.com/rust-lang/rust/pull/61559/files#diff-e682b38b565035a82f29560c3b79144bR208">https://github.com/rust-lang/rust/pull/61559/files#diff-e682b38b565035a82f29560c3b79144bR208</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>